
concrete TinySwe of Tiny = {

flags coding = utf8;

param Num = Sg | Pl;
param Defness = Indef | Def;
param Gen = Utr | Neu;
param Case = Nom | Acc;

lincat 

Phr, S = {s : Str};
NP, Subj, DObj, IObj = {s : Str};
Pron = {s : Case => Str};
VP = {s,o : Str}; 
N, CN = {s : Num => Defness => Str; g : Gen};
A, AP = {s : Num => Defness => Gen => Str};
PP = {s : Str};
D = {s : Gen => Str; n : Num; d : Defness};
V, V2 = {s : Str};
V3 = {s : Str; p : Str};
P = {s : Str};

lin

phrase s = s;
sent subj vp = {s = subj.s ++ vp.s ++ vp.o};
que subj vp = {s = vp.s ++ subj.s ++ vp.o};

useV v = {s = v.s; o = []};
useV2 v do = {s = v.s; o = do.s};
useV3 v do io = {s = v.s; o = do.s ++ v.p ++ io.s};
ppVP vp pp = {s = vp.s; o = vp.o ++ pp.s};

mkSubj np = np;
mkDObj np = np;
mkIObj np = np;
mkV1 v = v;
mkV2 v = v;

subjPron p = {s = p.s!Nom};
dobjPron p = {s = p.s!Acc};
iobjPron p = {s = p.s!Acc};

detCN d cn = {s = d.s!cn.g ++ cn.s!d.n!d.d};
ppNP np pp = {s = np.s ++ pp.s};

adjCN ap cn = {s = \\n,d => ap.s!n!d!cn.g ++ cn.s!n!d; g = cn.g};
useN n = n;

useP p np = {s = p.s ++ np.s};
useA a = a;

house = mkN "hus" "huset" "hus" "husen" Neu;
car = mkN "bil" "bilen" "bilar" "bilarna" Utr;
truckdriver = mkN "lastbilsförare" "lastbilsföraren" "lastbilsförare" "lastbilsförarna" Utr;
big = mkA "stor" "stort" "stora";
small = mkA "liten" "litet" "små";
a = mkD "en" "ett" Sg Indef;
theSg = mkD "" "" Sg Def;
thePl = mkD "de" "de" Pl Def;
every = mkD "varje" "varje" Sg Indef;
all = mkD "alla" "alla" Pl Indef;
indefPl = mkD "" "" Pl Indef;
run = {s = "springer"};
sleep = {s = "sover"};
see = {s = "ser"};
hit = {s = "slår"};
give = {s = "ger"; p = "till"};
inn = {s = "i"};
over = {s = "över"};
under = {s = "under"};

i = mkpron "jag" "mig";
we = mkpron "vi" "oss";
you = mkpron "du" "dig";
she = mkpron "hon" "henne";
he = mkpron "han" "honom";
it = mkpron "den" "den";
they = mkpron "de" "dem";

oper 

mkN : Str -> Str -> Str -> Str -> Gen -> {s : Num => Defness => Str; g : Gen};
mkN a b c d g = {s = table {Sg => table {Indef => a; Def => b}; Pl => table {Indef => c; Def => d}}; g = g};

mkD : Str -> Str -> Num -> Defness -> {s : Gen => Str; n : Num; d : Defness};
mkD a b n d = {s = table {Utr => a; Neu => b}; n = n; d = d};

mkA : Str -> Str -> Str -> {s : Num => Defness => Gen => Str};
mkA a b c = {s = table {Sg => table {Indef => table {Utr => a; Neu => b}; _ => \\_ => c}; _ => \\_,_ => c}};

mkpron : Str -> Str -> {s : Case => Str};
mkpron a b = {s = table {Nom => a; Acc => b}};

}
